package com.weimei.conversionTreasure.activity;

import android.os.Bundle;

import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelProviders;

import com.chad.library.BR;
import com.weimei.conversionTreasure.R;
import com.weimei.conversionTreasure.app.AppViewModelFactory;
import com.weimei.conversionTreasure.databinding.ActivityMonthDetailBinding;
import com.weimei.conversionTreasure.viewModel.MonthDetailVM;

import me.goldze.mvvmhabit.base.BaseActivity;

public class MonthDetailActivity extends BaseActivity<ActivityMonthDetailBinding, MonthDetailVM> {


    @Override
    public int initContentView(Bundle savedInstanceState) {
        return R.layout.activity_month_detail;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }

    String className, times, types;

    @Override
    public void initParam() {
        super.initParam();
        className = getIntent().getStringExtra("className");
        times = getIntent().getStringExtra("time");
        types = getIntent().getStringExtra("type");
    }

    @Override
    public void initData() {
        super.initData();
        viewModel.setActivity(this);
        viewModel.time.set(times);
        viewModel.types.set(className);
        viewModel.type.set(types);

    }

    @Override
    public MonthDetailVM initViewModel() {
        AppViewModelFactory factory = AppViewModelFactory.getInstance(getApplication());
        return ViewModelProviders.of(this, (ViewModelProvider.Factory) factory).get(MonthDetailVM.class);
    }


}